import {ref,computed} from 'vue'
import{defineStore} from 'pinia'

export const useCounterStore = defineStore('counter',()=>{
    const count = ref(0)
    const doubleCount = computed(()=>{
        return count.value*2;
    })
    function addOne(){
        count.value++
    }
    function minusOne(){
        count.value --
    }
    function clearCount(){
        count.value = 0;
    }
    return {
        count,
        doubleCount,
        addOne,
        minusOne,
        clearCount
    }
})